//
//  AppDelegate.m
//  MOSAD_HW2_1
//
//  Created by Jason on 2016/10/29.
//  Copyright © 2016 Jason. All rights reserved.
//

#import "AppDelegate.h"
#import "VCLogin.h"
#import "VCPunchList.h"
#import "VCAddPunch.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

@synthesize time = _time;
@synthesize location = _location;
@synthesize scenicSpots = _scenicSpots;
@synthesize experience = _experience;
@synthesize pictureNums = _pictureNums;
@synthesize publishTimes = _publishTimes;
@synthesize tableView = _tableView;
//@synthesize userName = _userName;
//@synthesize password = _password;
//@synthesize email = _email;
//@synthesize phoneNumber = _phoneNumber;

@synthesize number = _number;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    _time = [[NSMutableArray alloc] init];
    _location = [[NSMutableArray alloc] init];
    _scenicSpots = [[NSMutableArray alloc] init];
    _experience = [[NSMutableArray alloc] init];
    _pictureNums = [[NSMutableArray alloc] init];
    _publishTimes = 0;
    _number = 1;
    
    [_time addObject:@"2020 - 10 - 28  20 : 19 : 30"];
    [_location addObject:@"中山大学"];
    [_scenicSpots addObject:@"至善园"];
    [_experience addObject:@"生活舒适"];
    NSMutableArray * array1 = [[NSMutableArray alloc] init];
    for(int i = 0; i < 2; i++) {
        [array1 addObject:[NSString stringWithFormat:@"%d.jpg", i+1]];
    }
    [_pictureNums addObject:array1];
    
    [_time addObject:@"2020 - 10 - 29  22 : 59 : 30"];
    [_location addObject:@"中山大学"];
    [_scenicSpots addObject:@"至善园"];
    [_experience addObject:@"终于写完啦！！"];
    NSMutableArray * array2 = [[NSMutableArray alloc] init];
    for(int i = 0; i < 3; i++) {
        [array2 addObject:[NSString stringWithFormat:@"%d.jpg", i+5]];
    }
    [_pictureNums addObject:array2];
    
    [_time addObject:@"2020 - 10 - 30  21 : 44 : 30"];
    [_location addObject:@"中山大学"];
    [_scenicSpots addObject:@"至善园"];
    [_experience addObject:@"好吧，我想多了！！"];
    NSMutableArray * array3 = [[NSMutableArray alloc] init];
    for(int i = 0; i < 2; i++) {
        [array3 addObject:[NSString stringWithFormat:@"%d.jpg", i+7]];
    }
    [_pictureNums addObject:array3];

    [_time addObject:@"2020 - 10 - 31  8 : 32 : 30"];
    [_location addObject:@"中山大学"];
    [_scenicSpots addObject:@"至善园"];
    [_experience addObject:@"这作业没完没了了对吧！！"];
    NSMutableArray * array4 = [[NSMutableArray alloc] init];
    for(int i = 0; i < 2; i++) {
        [array4 addObject:[NSString stringWithFormat:@"%d.jpg", i+3]];
    }
    [_pictureNums addObject:array4];
    
    
    
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    [self.window makeKeyAndVisible];
    
    VCPunchList * vcPunchList = [[VCPunchList alloc] init];
    //vcPunchList.title = @"打卡清单";
    //vcPunchList.view.backgroundColor = [UIColor grayColor];
    UINavigationController * nav1 = [[UINavigationController alloc] initWithRootViewController:vcPunchList];
    
    VCAddPunch * vcAddPunch = [[VCAddPunch alloc] init];
    //vcAddPunch.title = @"添加打卡";
    //vcAddPunch.view.backgroundColor = [UIColor blueColor];
    UINavigationController * nav2 = [[UINavigationController alloc] initWithRootViewController:vcAddPunch];
    
    VCLogin * vcLogin = [[VCLogin alloc] init];
    //vcLogin.title = @"我的";
    //vcLogin.view.backgroundColor = [UIColor greenColor];
    UINavigationController * nav3 = [[UINavigationController alloc] initWithRootViewController:vcLogin];
    //创建一个控制器数组对象
    //将所有要被分栏控制器管理的对象添加到数组中
    NSArray * array = [NSArray arrayWithObjects:nav1, nav2, nav3, nil];
    //创建分栏控制器
    UITabBarController * tabVC = [[UITabBarController alloc] init];
    //将分栏视图控制器管理数组赋值
    tabVC.viewControllers = array;
    //设置分栏控制器的透明度
    tabVC.tabBar.translucent = NO;
    
    tabVC.navigationController.navigationBar.translucent = NO;
    tabVC.tabBarController.tabBar.translucent = NO;
    
    //将分栏控制器作为根视图控制器
    self.window.rootViewController = tabVC;
    
    //设置选中的视图控制器的索引
    //通过索引确定显示哪一个控制器
    tabVC.selectedIndex = 2;
    //当前显示的控制器对象
    if(tabVC.selectedViewController == vcLogin) {
        NSLog(@"当前显示的为登录界面");
    }
    
    
    return YES;
}


- (void)applicationWillResignActive:(UIApplication *)application {
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}


- (void)applicationDidEnterBackground:(UIApplication *)application {
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}


- (void)applicationWillEnterForeground:(UIApplication *)application {
    // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}


- (void)applicationWillTerminate:(UIApplication *)application {
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}


@end
